/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Modelo.DAL;

import java.util.Arrays;
import java.util.Iterator;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;

/**
 *
 * @author Rafael Barretta
 */
public class Seguridad_bkp {

    public Seguridad_bkp() {
    }

    public static boolean sesionValida(HttpServletRequest request, String[] array) {
        HttpSession sesion = request.getSession(); // obtenemos la sesion
        String privilegio = (String) sesion.getAttribute("privilegio");
        boolean cuentaConPriv = false;
        List list = Arrays.asList(array);
        Iterator it = list.iterator();

        if (privilegio == null) {
            return cuentaConPriv;
        }

        while (it.hasNext()) {
            String value = (String) it.next();
            System.out.println("Value :" + value);
            if (privilegio.equals(value)) {
                cuentaConPriv = true;
                System.out.println("Privilegio :" + value);
                break;
            }
        }
        return cuentaConPriv;
    }
}
